bitkeeper revision 1.557 (3fa7bf54uSRjwiFPziJvGyBirhU24A)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 4 Nov 2003 15:01:40 +0000 (15:01 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 4 Nov 2003 15:01:40 +0000 (15:01 +0000)
network.c, dom0_ops.h, processor.h, domain.c, dom0_ops.c, xi_build.c:
  More fixes and tweaks.

tools/internal/xi_build.c
xen/common/dom0_ops.c
xen/common/domain.c
xen/include/asm-i386/processor.h
xen/include/hypervisor-ifs/dom0_ops.h
xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c

index a08b6f8245e6c0d6919fc323d41a52fcf6219b7e..953a8205eb18857cd4d21376a8f895155e9f278d 100644 (file)
@@ -9,6 +9,9 @@
 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
 #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
 
+static unsigned long virt_startinfo_addr;
+static unsigned long startinfo_frame;
+
 static char *argv0 = "internal_domain_build";
 
 static long get_tot_pages(int domain_id)
@@ -313,10 +316,11 @@ static int setup_guestos(
         num_pgt_updates++;
     }
 
-    builddomain->virt_startinfo_addr =
+    virt_startinfo_addr =
         virt_load_addr + ((alloc_index-1) << PAGE_SHIFT);
+    startinfo_frame = page_array[alloc_index-1];
 
-    start_info = map_pfn(page_array[alloc_index-1]);
+    start_info = map_pfn(startinfo_frame);
     memset(start_info, 0, sizeof(*start_info));
     start_info->pt_base     = virt_load_addr + ((tot_pages-1) << PAGE_SHIFT);
     start_info->mod_start   = initrd_addr;
@@ -473,8 +477,8 @@ int main(int argc, char **argv)
     ctxt->i386_ctxt.ss = FLAT_RING1_DS;
     ctxt->i386_ctxt.cs = FLAT_RING1_CS;
     ctxt->i386_ctxt.eip = load_addr;
-    ctxt->i386_ctxt.esp = launch_op.u.builddomain.virt_startinfo_addr;
-    ctxt->i386_ctxt.esi = launch_op.u.builddomain.virt_startinfo_addr;
+    ctxt->i386_ctxt.esp = virt_startinfo_addr;
+    ctxt->i386_ctxt.esi = virt_startinfo_addr;
     ctxt->i386_ctxt.eflags = (1<<9) | (1<<2);
 
     /* FPU is set up to default initial state. */
@@ -496,7 +500,7 @@ int main(int argc, char **argv)
 
     /* Ring 1 stack is the initial stack. */
     ctxt->ring1_ss  = FLAT_RING1_DS;
-    ctxt->ring1_esp = launch_op.u.builddomain.virt_startinfo_addr;
+    ctxt->ring1_esp = virt_startinfo_addr;
 
     /* No debugging. */
     memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
@@ -507,6 +511,8 @@ int main(int argc, char **argv)
     ctxt->failsafe_callback_cs  = FLAT_RING1_CS;
     ctxt->failsafe_callback_eip = 0;
 
+    ctxt->start_info_frame = startinfo_frame;
+
     launch_op.u.builddomain.domain   = domain_id;
     launch_op.u.builddomain.num_vifs = atoi(argv[3]);
 
index aad13c56266e93c6bdc4ff915904a8bdd2c5edc1..9d820126e3c78dcd34b41f775f7529644964d3ff 100644 (file)
@@ -321,6 +321,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
                     p->failsafe_selector;
                 op.u.getdomaininfo.ctxt.failsafe_callback_eip = 
                     p->failsafe_address;
+                op.u.getdomaininfo.ctxt.start_info_frame = 
+                    p->thread.start_info_frame;
             }
         }
         read_unlock_irqrestore(&tasklist_lock, flags);
index e5c590a061bfc97b173e36592e76fde11b61804b..b8b015f8c424bc7f14b1d51c16a551298dae4b09 100644 (file)
@@ -325,7 +325,7 @@ void release_task(struct task_struct *p)
  */
 int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
 {
-    start_info_t *virt_startinfo_addr;
+    start_info_t *startinfo;
     unsigned long phys_l2tab;
     net_ring_t *shared_rings;
     net_vif_t *net_vif;
@@ -365,6 +365,7 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
     p->event_address     = builddomain->ctxt.event_callback_eip;
     p->failsafe_selector = builddomain->ctxt.failsafe_callback_cs;
     p->failsafe_address  = builddomain->ctxt.failsafe_callback_eip;
+    p->thread.start_info_frame = builddomain->ctxt.start_info_frame;
     
     /* NB. Page base must already be pinned! */
     phys_l2tab = builddomain->ctxt.pt_base;
@@ -375,18 +376,12 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
     /* Set up the shared info structure. */
     update_dom_time(p->shared_info);
 
-    virt_startinfo_addr = (start_info_t *)builddomain->virt_startinfo_addr;
-
-    /*
-     * We need to populate start_info struct within the context of the new
-     * domain. Thus temporarely install its pagetables.
-     */
-    __cli();
-    __asm__ __volatile__ ( 
-        "mov %%eax,%%cr3" : : "a" (pagetable_val(p->mm.pagetable)));
+    startinfo = (start_info_t *)
+        map_domain_mem(p->thread.start_info_frame << PAGE_SHIFT);
 
     /* Add virtual network interfaces and point to them in startinfo. */
-    while (builddomain->num_vifs-- > 0) {
+    while ( builddomain->num_vifs-- > 0 )
+    {
         net_vif = create_net_vif(p->domain);
         shared_rings = net_vif->shared_rings;
         if (!shared_rings) panic("no network ring!\n");
@@ -395,19 +390,16 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
     for ( i = 0; i < MAX_DOMAIN_VIFS; i++ )
     {
         if ( p->net_vif_list[i] == NULL ) continue;
-        virt_startinfo_addr->net_rings[i] = 
+        startinfo->net_rings[i] = 
             virt_to_phys(p->net_vif_list[i]->shared_rings);
-        memcpy(virt_startinfo_addr->net_vmac[i],
+        memcpy(startinfo->net_vmac[i],
                p->net_vif_list[i]->vmac, ETH_ALEN);
     }
 
     /* Add block io interface */
-    virt_startinfo_addr->blk_ring = virt_to_phys(p->blk_ring_base);
+    startinfo->blk_ring = virt_to_phys(p->blk_ring_base);
 
-    /* Reinstate the caller's page tables. */
-    __asm__ __volatile__ (
-        "mov %%eax,%%cr3" : : "a" (pagetable_val(current->mm.pagetable)));    
-    __sti();
+    unmap_domain_mem(startinfo);
 
     p->flags |= PF_CONSTRUCTED;
     
@@ -589,6 +581,9 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
     update_dom_time(p->shared_info);
     p->shared_info->domain_time = 0;
 
+    /* DOM0 can't be stopped/started, so no need for an ongoing s.i. frame. */
+    p->thread.start_info_frame = 0;
+
     virt_startinfo_address = (start_info_t *)
         (virt_load_address + ((alloc_index - 1) << PAGE_SHIFT));
     virt_stack_address  = (unsigned long)virt_startinfo_address;
index 4ba80103389ff22de657f72732bff4129ea391eb..6d05a61c75c7e71cc8ce9abf3e2528db0936a8d2 100644 (file)
@@ -354,6 +354,7 @@ struct tss_struct {
 };
 
 struct thread_struct {
+    unsigned long start_info_frame; /* Filled in on DOM0_START */
     unsigned long esp1, ss1;
 /* Hardware debugging registers */
     unsigned long      debugreg[8];  /* %%db0-7 debug registers */
@@ -385,7 +386,7 @@ extern struct desc_struct *idt_tables[];
 long set_fast_trap(struct task_struct *p, int idx);
 
 #define INIT_THREAD  {                                         \
-       0, 0,                                                   \
+       0, 0, 0,                                                \
        { [0 ... 7] = 0 },      /* debugging registers */       \
        { { 0, }, },            /* 387 state */                 \
        0x20, { 0, 0 },         /* DEFAULT_FAST_TRAP */         \
index 25708736c692177d2359577082699fec233c3421..cff8bca48c18dde398f9ba6d3758eba489ae926d 100644 (file)
@@ -41,6 +41,7 @@ typedef struct full_execution_context_st
     unsigned long event_callback_eip;
     unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
     unsigned long failsafe_callback_eip;
+    unsigned long start_info_frame;         /* Page frame containing s.i.   */
 } full_execution_context_t;
 
 #define MAX_CMD_LEN       256
@@ -94,7 +95,6 @@ typedef struct dom0_builddomain_st
 {
     /* IN variables. */
     unsigned int  domain;
-    unsigned long virt_startinfo_addr;
     unsigned int  num_vifs;
     full_execution_context_t ctxt;
 } dom0_builddomain_t;
index 31611b433eff548720a0437f60224caebdd1ee61..913acc7ab67dbeadc510ce2414ba7d55709aff0d 100644 (file)
@@ -517,7 +517,7 @@ int __init init_module(void)
         goto fail;
     }
     
-    err = request_irq(_EVENT_DEBUG, dbg_network_int, SA_SHIRQ, "debug", NULL);
+    err = request_irq(_EVENT_DEBUG, dbg_network_int, 0, "debug", NULL);
     if ( err )
         printk(KERN_WARNING "Non-fatal error -- no debug interrupt\n");